#ifndef REGISTER_H
#define REGISTER_H

#include <QDialog>
#include <QQueue>
#include <QCheckBox>
#include <QRadioButton>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QTextEdit>


QT_BEGIN_NAMESPACE
class QComboBox;
class QDialogButtonBox;
class QGridLayout;
class QLabel;
class QPushButton;
class QSpinBox;
class QLineEdit;
class QTabWidget;
class Dialog;
class Group;
class RenderArea;
QT_END_NAMESPACE

/** Class that represents a register, with groups of bits (fields).*/
class Register : public QGroupBox
{
        Q_OBJECT
public slots:
    void addGroup();
    void closeTab(int i);
    void removeRegister();
    void changeRegName(QString str);
    void changeOffset(int j);
    void currentTabChanged(int i);
public:
    Register(int c, Dialog *d);
    QTabWidget* getTabs(){return tabs;};
    QLabel* getBitsLabel(){return bitsLabel;};
    void setRegBits(int i){regBits=i;};
    int getRegBits(){return regBits;};
    QQueue<Group *>* getGroups(){return &groups;};
    int getId(){return id;};
    void setId(int i){id=i;};
    QString getCurrentOffset();
    void setCurrentOffsetIndex(int i);
    QLineEdit* getRegName(){return regName;};
    Dialog* getDial(){return dial;};
    QTextEdit* getDescription(){return description;};
    Qt::LayoutDirection getNotation();
    int taken[32];
    bool readOnly[32];
    RenderArea* renderArea;

private:
    QTabWidget* tabs;
    int regBits;
    int id;
    QLineEdit *regName;
    QLabel    *regNameLabel;
    QLabel    *bitsLabel;
    QLabel    *offsetLabel;
    QLabel    *descLabel;
    QTextEdit *description;
    QGridLayout *tabLayout;
    QQueue<Group *> groups;
    QPushButton *addGroupButton;
    QPushButton *closeButton;
    QDialogButtonBox *regButtonBox;
    Dialog* dial;
    QComboBox *offset;

    

};


#endif // REGISTER_H
